<template>
  <header class="header">
    <div class="header-container">
      <!-- Logo区域 -->
      <div class="logo">
        <router-link to="/">
          <img src="@/assets/logo.png" alt="斑马中国" />
        </router-link>
      </div>

      <!-- 导航菜单 -->
      <nav class="nav-menu">
        <el-menu mode="horizontal" :router="true">
          <el-menu-item index="/">首页</el-menu-item>
          
          <el-sub-menu index="copyright-service">
            <template #title>版权服务</template>
            <el-menu-item index="/copyright/evidence">版权存证</el-menu-item>
            <el-menu-item index="/copyright/register">版权登记</el-menu-item>
            <el-menu-item index="/copyright/monitor">传播监测</el-menu-item>
            <el-menu-item index="/copyright/evidence-collection">电子取证</el-menu-item>
            <el-menu-item index="/copyright/rights-protection">在线维权</el-menu-item>
            <el-menu-item index="/copyright/evidence-verification">证据核验</el-menu-item>
          </el-sub-menu>

          <el-sub-menu index="copyright-market">
            <template #title>版权市场</template>
            <el-menu-item index="/market/works">作品展示</el-menu-item>
            <el-menu-item index="/market/purchase">版权采购</el-menu-item>
            <el-menu-item index="/market/factory">光厂</el-menu-item>
            <el-menu-item index="/market/data">文化大数据</el-menu-item>
            <el-menu-item index="/market/cloud">狮子云云</el-menu-item>
            <el-menu-item index="/market/academy">叫叫学院</el-menu-item>
          </el-sub-menu>

          <el-menu-item index="/content-review">内容审核</el-menu-item>

          <el-sub-menu index="about">
            <template #title>关于我们</template>
            <el-menu-item index="/about/intro">平台介绍</el-menu-item>
            <el-menu-item index="/about/news">新闻资讯</el-menu-item>
            <el-menu-item index="/about/legal">法律声明</el-menu-item>
          </el-sub-menu>
        </el-menu>
      </nav>

      <!-- 用户操作区 -->
      <div class="user-actions">
        <el-button type="text" @click="handleLogin">登录</el-button>
        <el-button type="primary" @click="handleRegister">注册</el-button>
      </div>
    </div>
  </header>
</template>

<script>
import { defineComponent } from 'vue';
import { useRouter } from 'vue-router';

export default defineComponent({
  name: 'Header',
  setup() {
    const router = useRouter();

    const handleLogin = () => {
      router.push('/login');
    };

    const handleRegister = () => {
      router.push('/register');
    };

    return {
      handleLogin,
      handleRegister
    };
  }
});
</script>

<style lang="scss">
.header {
  height: $header-height;
  background: $background-color-white;
  box-shadow: $box-shadow-light;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: $z-index-fixed;

  &-container {
    @include flex(row, space-between, center);
    max-width: $container-width;
    margin: 0 auto;
    padding: 0 $spacing-base;
    height: 100%;
  }

  .logo {
    img {
      height: 40px;
      vertical-align: middle;
    }
  }

  .nav-menu {
    flex: 1;
    margin: 0 40px;

    :deep(.el-menu) {
      border: none;
    }

    :deep(.el-menu--horizontal) {
      border-bottom: none;
    }
  }

  .user-actions {
    display: flex;
    gap: 12px;
    align-items: center;

    .el-button {
      padding: 8px 16px;
    }
  }

  // 响应式设计
  @media screen and (max-width: 768px) {
    .nav-menu {
      display: none;
    }
    
    .header-container {
      padding: 0 10px;
    }
  }
}
</style>
